home *** CD-ROM | disk | FTP | other *** search
- Path: galaxy.ucr.edu!not-for-mail
- From: thp@cs.ucr.edu (Tom Payne)
- Newsgroups: comp.lang.c++
- Subject: Re: Multithreading in C++?
- Date: 13 Jan 1996 21:16:28 GMT
- Organization: University of California, Riverside Department of Computer Science
- Message-ID: <4d97fc$ps6@galaxy.ucr.edu>
- References: <4co6mf$98d@serv.hinet.net> <4cta8m$i74@isoit109.bbn.hp.com>
- NNTP-Posting-Host: corvette.ucr.edu
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Manfred_Lange (Manfred_Lange@bbn.hp.com) wrote:
- : jcwang@hntp2.hinet.net (John C. Wang) wrote:
- : >
- : >Does anyone know if there is a standard C interface for multithread
- : >programming? Under MS Visual C++ there are thread functions for the NT, but I
- : >am pretty sure that's not a standard function call. What do they use in UNIX?
- : >Does the POSIX standards specify this?
- : >
- : >Please reply to my email if possible.
- : >
- : >jcwang@csie.ntu.edu.tw
- : >
- :
- : As far as I know, there are no functions in the standard libraries that deal
- : with threads. This is typically left to the underlying operating system.
-
- Not only do the C and C++ standards not support multithreading, they
- sort of discourage it, e.g., by specifying that the behavior of a
- program is "undefined" if a signal handler reads any static variable.
- There are, however, some standard threads packages, e.g. Pthreads that
- have been ported to many systems.
-
- On most systems one can (nonportably) implement threads by passing the
- control with setjmp and longjmp. Such packages are officially
- non-portable, but they work on most systems. Porting them usually
- requires nothing more than determining how to initialize a jmp_buf
- with a new stack-pointer setting. (As I recall, John English had an
- article in SIGPLAN Notices about a year ago on such a package.) There
- is serious question whether such packages work in the presence of
- exceptions.
-
- In any case, the lack of libraries that are safe in the presence of
- multi-threading remains a problem.
-
- Tom Payne (thp@cs.ucr.edu)
-
-